package kr.hyunist.androidcomplete01saeildamil.ch09;

import kr.hyunist.androidcomplete01saeildamil.*;
import android.app.*;
import android.os.*;
import android.view.*;
import android.widget.*;

public class OptionMenuTest extends Activity {
	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		TextView tv = new TextView(this);
		tv.setText("메뉴 키 눌르셈!");
		setContentView(tv);
	}

	@Override
	public boolean onCreateOptionsMenu(Menu menu) {
		super.onCreateOptionsMenu(menu);

		MenuInflater inflater = getMenuInflater();
		inflater.inflate(R.menu.optionmenu, menu);
		
		
		/*MenuItem item = menu.add(0, 1, 0, "자장");
		item.setIcon(R.drawable.ic_launcher);
		item.setAlphabeticShortcut('a');

		menu.add(0, 2, 0, "잠봉").setIcon(R.drawable.ic_launcher);

		SubMenu etc = menu.addSubMenu("기타");
		etc.add(0, 3, 0, "우동");
		etc.add(0, 4, 0, "중화비빔밥");*/

		return true;
	}

	@Override
	public boolean onOptionsItemSelected(MenuItem item) {
		switch (item.getItemId()) {
		
		case R.id.jjajang:
			Toast.makeText(this, "자장은 맛있어!", Toast.LENGTH_SHORT).show();
			break;
		case R.id.jjambong:
			Toast.makeText(this, "잠봉은 매워야함!", Toast.LENGTH_SHORT).show();
			break;
		case R.id.udong:
			Toast.makeText(this, "우동은 시원해!", Toast.LENGTH_SHORT).show();
			break;
		case R.id.bibimbap:
			Toast.makeText(this, "중화 비빔밥은 진짜 맛남!", Toast.LENGTH_SHORT).show();
			break;

		
		/*case 1:
			Toast.makeText(this, "자장은 맛있어!", Toast.LENGTH_SHORT).show();
			break;
		case 2:
			Toast.makeText(this, "잠봉은 매워야함!", Toast.LENGTH_SHORT).show();
			break;
		case 3:
			Toast.makeText(this, "우동은 시원해!", Toast.LENGTH_SHORT).show();
			break;
		case 4:
			Toast.makeText(this, "중화 비빔밥은 진짜 맛남!", Toast.LENGTH_SHORT).show();
			break;*/
		}
		return false;
	}

}
